<?php 
  require_once('Admin/Common/template/inc_admin.php');


     $sql = "select * from comments join users on comments.uid=users.uid";
      $result = mysql_query($sql) or die('查询失败！'.mysql_error());
?>
<!--PAGE CONTENT -->
<div id="content">

  <div class="inner" style="min-height:1200px;">
    <h1 class="text-center">查询留言</h1>
    <button class="btn btn-default" style="font-family: 微软雅黑; position: relative;left: 80% ;width:80px;height:40px"><a href="admin.php?c=comments&m=form">添加评论</a></button>
    <div class="form-group">
   
    </div>
  <table align="center" class="table table-bordered">
    <tr>
      <th class="text-center">序号</th>
      <th class="text-center">留言人</th>
      <th class="text-center">留言新闻号</th>
      <th class="text-center">留言内容</th>
      <th class="text-center">操作</th>
    </tr>
    <?php
  while($row=mysql_fetch_array($result)){
      echo '<tr>';
      echo '<td class="text-center">'.$row['cid'].'</td>';
      echo '<td  class="text-center">'.$row['uname'].'</td>';
      echo '<td  class="text-center">'.$row['nid'].'</td>';
      echo '<td  class="text-center">'.$row['comment'].'</td>';
      echo '<td> <a href="admin.php?c=comments&m=editcomments&id='.$row['cid'].' ">修改</a> | 
       
     <a href="admin.php?c=comments&m=delcomments&id='.$row['cid'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';
      echo '</tr>';  
    }
      echo '</table>';

$totalrows=mysql_num_rows($result);
echo '<h3 style="font-family:微软雅黑;text-align:right;color:purple;position:relative;right:50px">共有'.$totalrows.'条评论</h3>'; 
?> 

<!-- $totalrows = count($data['users']);
            echo '<h2 style="font-family:微软雅黑;text-align:right;color:red;position:relative;right:50px">共有'.$totalrows.'名用户</h2>';  -->
</div>
</div>
<!--END PAGE CONTENT -->

       </body>
        </html>
